package com.hejie.userservice.service;

import com.hejie.userservice.dto.UserDTO;
import com.hejie.userservice.dto.UserLoginRequest;
import com.hejie.userservice.dto.UserRegisterRequest;
import com.hejie.userservice.dto.UserUpdateRequest;
import com.hejie.userservice.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.security.core.userdetails.UserDetailsService;

import java.util.Map;

public interface UserService extends UserDetailsService {

    /**
     * 用户注册
     */
    UserDTO register(UserRegisterRequest registerRequest);

    /**
     * 用户登录
     */
    Map<String, String> login(UserLoginRequest loginRequest);

    /**
     * 根据ID获取用户信息
     */
    UserDTO getUserById(Long userId);

    /**
     * 根据用户名获取用户信息
     */
    UserDTO getUserByUsername(String username);

    /**
     * 更新用户资料
     */
    UserDTO updateUser(Long userId, UserUpdateRequest updateRequest);

    /**
     * 修改密码
     */
    boolean changePassword(Long userId, String oldPassword, String newPassword);

    /**
     * 管理员更新用户状态
     */
    UserDTO updateUserStatus(Long userId, User.UserStatus status);

    /**
     * 分页查询用户
     */
    Page<UserDTO> queryUsers(String keyword, Pageable pageable);

    /**
     * 刷新JWT令牌
     */
    Map<String, String> refreshToken(String refreshToken);

    /**
     * 登出
     */
    void logout(String username);
}